//
//  NSMutableAttributedString+Helper.m
//  lvfj
//
//  Created by lvfeijun on 2021/8/10.
//  Copyright © 2021 Goudu KuaiEx Technology(Shenzhen)Co.,ltd. All rights reserved.
//

#import "NSMutableAttributedString+Helper.h"

@implementation NSMutableAttributedString (Helper)


+ (NSMutableAttributedString *)hq_createAttributedString:(NSString *)string foregroundColor:(UIColor *)color FontAttributeName:(UIFont *)font
{
    NSMutableAttributedString *categoryNameStr = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:color}];
    
    return categoryNameStr;
}

- (void)addAttributes:(NSDictionary<NSAttributedStringKey, id> *)attrs string:(NSString *)string{
    if ([NSString hq_isEmptyString:string]||[NSString hq_isEmptyString:self.mutableString]) {
        return;
    }
    NSRange range = [self.mutableString rangeOfString:string];
    if (range.length) {
        [self addAttributes:attrs range:range];
    }
}

@end
